﻿/*********************弘石项目三组************************
*  功能描述：客户信息录入控制器
*  作者：刘伟康
*  时间：2021-12-9
*  修改人：刘伟康
*  修改时间：2021-12-9
*********************弘石项目三组************************/
using Hong.Business.Business_CustomerManagement;
using Hong.IRepository.IRepository_CustomerManagement;
using Hong.Model.SysDomain.Model_CustomerManagement;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WeHongshibApI.Controllers.Controllers_CustomerManagement
{
    [ApiExplorerSettings(GroupName = "Customer")]
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CustInfoController : ControllerBase
    {
        #region 构造器注入
        private readonly CusInfoBusiness _custInfo;
        public CustInfoController(CusInfoBusiness custInfo)
        {
            _custInfo = custInfo;
        }
        #endregion

        #region 客户信息录入
        #region 添加基本信息
        /// <summary>
        /// 添加客户基本信息
        /// </summary>
        /// <param name="customer"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult PostCustomer(Customer customer)
        {
            var i = _custInfo.PostCustomer(customer);
            return Ok(i);
        }
        #endregion

        #region 甲方负责人

        /// <summary>
        /// 添加甲方负责人信息
        /// </summary>
        /// <param name="person"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult PostPerson(Person person)
        {
            var i = _custInfo.PostPerson(person);
            return Ok(i);
        }
        /// <summary>
        /// 甲方负责人显示
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet]
        public IActionResult GetPerson(string custid)
        {
            var list = _custInfo.GetPerson(custid);
            return Ok(list);
        }
        /// <summary>
        /// 甲方负责人删除
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpDelete]
        public IActionResult DeletePerson(string id)
        {
            var i = _custInfo.DeletePerson(id);
            return Ok(i);
        }
        /// <summary>
        /// 甲方负责人反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetPersonFT(string id)
        {
            var list = _custInfo.GetPersonFT(id);
            return Ok(list);

        }
        /// <summary>
        /// 甲方负责人修改
        /// </summary>
        /// 
        [HttpPut]
        public IActionResult PutPerson(Person person)
        {
            var i = _custInfo.PutPerson(person);
            return Ok(i);
        }
        #endregion

        #region 扩展信息
        /// <summary>
        /// 国家
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetAddress1()
        {
            var list = _custInfo.GetAddress1();
            return Ok(list);
        }
        /// <summary>
        /// 省市
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetAddress2(string id)
        {
            var list = _custInfo.GetAddress2(id);
            return Ok(list);
        }

        /// <summary>
        /// 客户类型
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetTypes()
        {
            var list = _custInfo.GetTypes();
            return Ok(list);
        }
        /// <summary>
        /// 所属行业
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetIndustry()
        {
            var list = _custInfo.GetIndustry();
            return Ok(list);
        }
        /// <summary>
        /// 添加扩展信息
        /// </summary>
        [HttpPost]
        public IActionResult PostExtended(Extended extended)
        {
            var i = _custInfo.PostExtended(extended);
            return Ok(i);
        }
        #endregion

        #region 满意度调查
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="satisfaction"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult PostSatisfaction(Satisfaction satisfaction)
        {
            return Ok(_custInfo.PostSatisfaction(satisfaction));
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public IActionResult DeleteSatisfaction(string id)
        {
            return Ok(_custInfo.DeleteSatisfaction(id));
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSatisfaction(string custid)
        {
            return Ok(_custInfo.GetSatisfaction(custid));
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSatisfactionFT(string id)
        {
            return Ok(_custInfo.GetSatisfactionFT(id));
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="satisfaction"></param>
        /// <returns></returns>
        [HttpPut]
        public IActionResult PutSatisfaction(Satisfaction satisfaction)
        {
            return Ok(_custInfo.PutSatisfaction(satisfaction));
        }
        #endregion

        #region 附件
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="satisfaction"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult PostAccessory(Accessory accessory)
        {
            var i = _custInfo.PostAccessory(accessory);
            return Ok(i);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public IActionResult DeleteAccessory(string id)
        {
            var i = _custInfo.DeleteAccessory(id);
            return Ok(i);
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetAccessory(string custid)
        {
            var list = _custInfo.GetAccessory(custid);
            return Ok(list);
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetAccessoryFT(string id)
        {
            var list = _custInfo.GetAccessoryFT(id);
            return Ok(list);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="satisfaction"></param>
        /// <returns></returns>
        [HttpPut]
        public IActionResult PutAccessory(Accessory accessory)
        {
            var i = _custInfo.PutAccessory(accessory);
            return Ok(i);
        }
        #endregion
        #endregion


    }
}
